<template>
  <div> 
      <Card title="试卷管理">
        <Input search enter-button="Search" placeholder="Enter something..." />
        <Table border :columns="columns7" :data="data6"></Table></Card>
  </div>
</template>
<script>
export default {
  props:['teacherName'],
    data () {
      return {
        teacherName1:this.teacherName,
        columns7: [
        
                     {
                         type: "index",
                         align: "center"
                                        },
                    {
                        title: '答题人',
                        key: 'whoAnswered',
                    },
                    {
                        title: '试卷类型',
                        key: 'testType'
                    },
                    {
                        title: '试卷题目',
                        key: 'examPageTitle'
                    },
                     {
                        title: '考试时间',
                        key: 'examTime'
                    },
                     {
                        title: '出卷试卷时间',
                        key: 'setquestime'
                    },
                     {
                        title: '答题时间',
                        key: 'answeredTime'
                    },
                     {
                        title: '总得分',
                        key: 'scare'
                    },
                     {
                        title: '学生评价',
                        key: 'StudentWords'
                    },
                     {
                        title: '试卷评分',
                        key: 'valueHalf'
                    },
                     {
                        title: '选择题得分',
                        key: 'sum1'
                    },
                     {
                        title: '多选题得分',
                        key: 'sum2'
                    },
                     {
                        title: '判断题得分',
                        key: 'sum3'
                    },
                     {
                        title: '填空题得分',
                        key: 'sum4'
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 150,
                        align: 'center',
                        render: (h, params) => {
                            return h('div', [
                                h('Button', {
                                    props: {
                                        type: 'primary',
                                        size: 'small'
                                    },
                                    style: {
                                        marginRight: '5px'
                                    },
                                    on: {
                                        click: () => {
                                            this.show(params.index)
                                        }
                                    }
                                }, '详情'),
                                h('Button', {
                                    props: {
                                        type: 'error',
                                        size: 'small'
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index)
                                        }
                                    }
                                }, '删除')
                            ]);
                        }
                    }
                ],
                data6: []
      }
},
    beforeMount() {
      this.getTeacherInfo()
   },
    methods: {
       getTeacherInfo() {
      let teachername = this.teacherName1;
      var teacherMsg = { setter: teachername };
      this.$axios({
        method: "post",
        url: "http://"+this.urlpath+"/FindOneTeacherExamedMsg",
        data: teacherMsg
      }).then(res => {
        this.data6=res.data
        console.log(this.OneTeacherAllstudentedMsg)
      });
    },
     Inter(index){
        var yourscore=this.OneTeacherAllstudentedMsg[index]
          this.$router.push({
          path:'/Transcript',
          query:{Msg:yourscore,teacherName:this.teacherName}
        })
      },
         show (index) {
                this.$Modal.info({
                    title: '详情',
                    content: `答题人：${this.data6[index].whoAnswered}
                    <br>考试类型：${this.data6[index].testType}
                    <br>考试时长：${this.data6[index].examTime}
                    <br>试卷题目：${this.data6[index].examPageTitle}
                    <br>出题时间：${this.data6[index].setquestime}
                    <br>答题时间：${this.data6[index].answeredTime}
                    <br>总分：${this.data6[index].scare}
                    <br>学生评价：${this.data6[index].StudentWords}
                    <br>试卷评分：${this.data6[index].valueHalf}
                    <br>单选题得分：${this.data6[index].sum1}
                    <br>多选题得分：${this.data6[index].sum2}
                    <br>判断题得分：${this.data6[index].sum3}
                    <br>填空题得分：${this.data6[index].sum4}`
                })
            },
            remove (index) {
                this.data6.splice(index, 1);
            }
    }
}
</script>
<style scoped>
.pos{
  position: absolute;
  top:10px;
  left: 80px;
}
</style>